package com.stx.bms.web;

import com.stx.bms.dao.BlogDAO;
import com.stx.bms.dao.BlogDAOImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/admin/blog-del")
public class BlogDeleteServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String id = request.getParameter("bid");

        BlogDAO dao = new BlogDAOImpl();
        dao.delete( Integer.parseInt(id) );

        response.sendRedirect("blog-list");
    }
}
